package com.zsw.security.controller;

import com.zsw.security.domain.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author 张士伟
 * @date 2020/7/25 15:59
 **/
@Api(value = "用户controller", tags = {"用户的操作接口"})
@Controller
public class RouterController {
    /*进入首页*/
    @ApiOperation(value = "获取用户信息12",tags = "第一个")
    @RequestMapping({"/", "/index"})
    public String index() {
        return "index";
    }

    /*进入登录页面*/
    @RequestMapping("/toLogin")
    public String toLogin() {
        return "views/login";
    }


    /*跳转级别为1的页面*/
    @RequestMapping("/level1/{id}")
    public String level1(@PathVariable("id") int id) {
        return "views/level1/" + id;
    }

    /*跳转级别为2的页面*/
    @RequestMapping("/level2/{id}")
    public String level2(@PathVariable("id") int id) {
        return "views/level2/" + id;
    }

    /*跳转级别为1的页面*/
    @RequestMapping("/level3/{id}")
    public String level3(@PathVariable("id") int id) {
        return "views/level3/" + id;
    }

    @ResponseBody
    @ApiOperation(value = "获取用户信息")
    @RequestMapping({"/inde"})
    public String inde(@ApiParam(name = "id", value = "用户") String id) {
        return "index";
    }

    @ApiOperation(value = "更改用户信息")
    @PostMapping("/updateUserInfo")
    public String updateUserInfo(@RequestBody @ApiParam(name = "用户对象", value = "传入json格式", required = true) User user
    ) {
        return "success";
    }
}
